import struct
with open(r'C:\Users\Administrator\Desktop\djy.txt','wb') as book:
    data = struct.pack('>i4sh',7,b'wookshihzudafagageagddd1544',454)
    print(data)
    c = book.write(data)
    book.close()